from rest_framework import serializers
from .models import MedicineDirectionModel, MedicineClassificationModel, MedicineModel, MedicineContentModel

# 药物方向序列化器
class MedicineDirectionModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = MedicineDirectionModel
        fields = [
            'id', 
            'direction'
        ]

# 药物分类序列化器
class MedicineClassificationModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = MedicineClassificationModel
        fields = [
            'id', 
            'classification', 
            'recomment_home', 
            'medicine_direction'
        ]

# 药物序列化器
class MedicineModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = MedicineModel
        fields = [
            'id', 
            'name', 
            'content', 
            'medicine_image', 
            'bibliography', 
            'external_links', 
            'medicine_classification'
        ]

# 药物内容序列化器
class MedicineContentModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = MedicineContentModel
        fields = [
            'id', 
            'content', 
            'medicine'
        ]